package com.shoppingCart.converter;

import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import com.shoppingCart.dataobject.Customer;
import com.shoppingCart.utils.KeyUtil;

import java.math.BigDecimal;

/**
 * create By lihao
 */
public class UserInfoToCustomer {
   public static Customer convert(WxMaUserInfo userInfo){
       Customer result = new Customer();
       result.setOpenId(userInfo.getOpenId());
       result.setBalance(BigDecimal.ZERO);
       result.setCity(userInfo.getCity());
       result.setCountry(userInfo.getCountry());
       result.setProvince(userInfo.getProvince());
       result.setNickName(userInfo.getNickName());
       result.setGuarantee(BigDecimal.ZERO);
       result.setStatus(0);
       result.setUserId(KeyUtil.genUniqueKey());
       return  result;
   }
}
